﻿using System.Windows;
using DevControlLibrary.Common;
using DBAccessLibrary.Model;

namespace DevControlLibrary.UI
{
    /// <summary>
    /// RegistDB.xaml 的交互逻辑
    /// </summary>
    public partial class RegistDB
    {
       
        public RegistDB()
        {
            InitializeComponent();
            XmlHelper.Instance.SetTheme(this);
        }

        public void BindData(ConnectionModel model)
        {
            this.dbConnection.SetData(model);
        }
      
        private void DxWindowKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
           if(e.Key == System.Windows.Input.Key.Enter)
           {
               btnOK_Click(null, null);
           }
        }

        public void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if(this.dbConnection.SubmitAction().Connection())
            {
                this.DialogResult = true;
            }
        }
        public void btnCanel_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}
